#ifndef	__UAS_SPRITE_H__
#define	__UAS_SPRITE_H__

#include"..\AuroraSupport\AuroraSprite.h"
#include<d3d9.h>
#include<d3dx9.h>
#include<iostream>
#include<string>
#include<assert.h>

using namespace std;

struct VERTEX_T
{
	D3DXVECTOR3 v;
	D3DCOLOR	c;
	D3DXVECTOR2 texUV;
	static const DWORD fvf;

	VERTEX_T()
	{
		v = D3DXVECTOR3(0,0,0);
		c = D3DCOLOR_ARGB(0,0,0,0);
	}

	VERTEX_T(float x,float y,float z,D3DCOLOR dif)
	{
		v = D3DXVECTOR3(x,y,z);
		c = dif;
	}

	VERTEX_T(float x,float y,float z,D3DCOLOR dif,float texU,float texV)
	{
		v = D3DXVECTOR3(x,y,z);
		c = dif;
		texUV = D3DXVECTOR2(texU,texV);
	}
};
//const DWORD VERTEX_T::fvf = D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1;


class UASSprite:public AuroraSprite
{
private:
	IDirect3DTexture9* _pTex;

public:
	UASSprite();
	UASSprite(const IDirect3DDevice9* const device,const string texName);
	~UASSprite();

	void LoadAuroraSprite(char* filename);


	/**
		Paint texture basic.
		PaintModule,PaintFrame etc functions rely on this function.
	*/
	void Render_2D(IDirect3DDevice9* const device,
							int x,int y,int w,int h,int u,int v,int ul,int vl,
							D3DXCOLOR c0,D3DXCOLOR c1,D3DXCOLOR c2,D3DXCOLOR c3,
							bool bTrans,float alpha);

	void PaintModule(IDirect3DDevice9* const device,int curModuleIdx,int x,int y,int ox,int oy);

	void PaintFModule(IDirect3DDevice9* const device,string curModuleId,int x,int y,int ox,int oy);
	void PaintFrame(IDirect3DDevice9* const device,int curFrameIdx,int x,int y);

	void PaintAFrame(IDirect3DDevice9* const device,string frameId,int x,int y,int ox,int oy);
	
};

#endif	//	__UAS_SPRITE_H__